export const mixins = {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      hzname: '',
      hzbh: '',
      jcbh: '',
      jcdjh: '',
      jianguanj2hover: false,
      jianguanj21hover: true,
      kv: 0,
      mas: 0,
      ms: 0,
      ma: 0,
      bgtips: '',
      bgtipstwo: '',
      wtext: '',
      tiptext: '',
      jlstips: '',
      jlstipstwo: '',
      taskdata: [
        {
          id: 1,
          name: '选择检测设备及模体'
        },
        {
          id: 2,
          name: '打开视野灯'
        },
        {
          id: 3,
          name: '放置检测设备及模体'
        },
        {
          id: 4,
          name: '调节SID'
        },
        {
          id: 5,
          name: '调整照射野'
        },
        {
          id: 6,
          name: '登录工作站'
        },
        {
          id: 7,
          name: '设置曝光参数'
        },
        {
          id: 8,
          name: '第一次曝光'
        },
         {
          id: 8.21,
          name: '铜过滤'
        },
         {
          id: 8.3,
          name: '第二次曝光'
        },
        {
          id: 911,
          name: '记录数值'
        }
      ],
      jboxdata: [
        {
          id: 1,
          bsid: 1,
          name: '检测方法'
        },
        
      ],
      wpdata: [
        {
          id: 1,
          name: '笔记本电脑',
          src: require('@/images/wp1.png')
        },
        {
          id: 2,
          name: '多探测器XR',
          src: require('@/images/wp2.png')
        },
        {
          id: 3,
          name: '数据转换器',
          src: require('@/images/wp3.png')
        },
        {
          id: 4,
          name: '20mm铝板',
          src: require('@/images/wp11.png')
        },
        {
          id: 5,
          name: '铅板',
          src: require('@/images/wp5.png')
        },
        {
          id: 6,
          name: '1.0mm铜板',
          src: require('@/images/wp6.png')
        },
        {
          id: 7,
          name: '1.5mm铜板',
          src: require('@/images/wp7.png')
        },
        {
          id: 8,
          name: '准直度检测板',
          src: require('@/images/wp8.png')
        },
        {
          id: 9,
          name: '线束垂直度测试筒',
          src: require('@/images/wp9.png')
        },
        {
          id: 10,
          name: '毫米级刻度铅尺',
          src: require('@/images/wp10.png')
        },
        {
          id: 11,
          name: '铅板(15cm*15cm*2mm)',
          src: require('@/images/wp11.png')
        },
        {
          id: 12,
          name: '铅块(4cm*4cm*4mm)',
          src: require('@/images/wp12.png')
        },
        {
          id: 13,
          name: '屏片X射线密着检测板',
          src: require('@/images/wp13.png')
        },
        {
          id: 14,
          name: '高对比分辨力测试卡',
          src: require('@/images/wp14.png')
        },
        {
          id: 15,
          name: '低对比分辨力检测模体',
          src: require('@/images/wp15.png')
        },
        {
          id: 16,
          name: '胶带',
          src: require('@/images/wp16.png')
        }
      ],
      homedata: [
        {
          id: 1,
          name: '管电压指示的偏离检测'
        },
        {
          id: 2,
          name: '辐射输出重复性检测'
        },
        {
          id: 3,
          name: '输出量线性检测'
        },
        {
          id: 4,
          name: '有用线束半值层检测'
        },
        {
          id: 5,
          name: '曝光时间指示的偏离检测'
        }
      ]
    }
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {
    // 监听四个输入框
    hzname: {
      handler(i) {
        if (i != '') {
          this.clearmbfn()
        }
        if (i != '' && this.hzbh != '' && this.jcbh != '' && this.jcdjh != '') {
          this.taskids = 6.3
        }
      },
      deep: true,
      immediate: true
    },
    hzbh: {
      handler(i) {
        if (i != '') {
          this.clearmbfn()
        }
        if (
          i != '' &&
          this.hzname != '' &&
          this.jcbh != '' &&
          this.jcdjh != ''
        ) {
          this.taskids = 6.3
        }
      },
      deep: true,
      immediate: true
    },
    jcbh: {
      handler(i) {
        if (i != '') {
          this.clearmbfn()
        }
        if (
          i != '' &&
          this.hzbh != '' &&
          this.hzname != '' &&
          this.jcdjh != ''
        ) {
          this.taskids = 6.3
        }
      },
      deep: true,
      immediate: true
    },
    jcdjh: {
      handler(i) {
        if (i != '') {
          this.clearmbfn()
        }
        if (
          i != '' &&
          this.hzbh != '' &&
          this.hzname != '' &&
          this.jcbh != ''
        ) {
          this.taskids = 6.3
        }
      },
      deep: true,
      immediate: true
    },
    id: {
      handler(i) {
        if (i == 1 && this.taskids == 8) {
          this.tiptext = '请按下曝光按钮'
        }
       
      }
    }
  },
  //方法集合
  methods: {
    // 不再次检测跳转到完成页面
    go() {
      console.log('跳转到实验完成页面')
    },
    // 是否符合要求 二次提醒确认
    jlstipstwofn() {
       this.jlstips=''
      this.jlstipstwo = ''
        this.$router.push({
        name: 'all'
      })
    },
    // 记录数值完成
    jlsfn() {
      console.log('执行了',this.id,this.taskids);
      
      if (this.taskids == 911) {
        this.jlstips =
          '某某人民医院某某品牌某某型号的DR机质量控制性能验收检测（AEC响应性检测）是否符合《中华人民共和国卫生行业标准WS 76-2020医用X射线诊断设备质量控制检测规范》的要求。'
      }

    },
    // 曝光提示确认
    bgqdfn() {
      // 第一次曝光
      if (this.taskids == 8) { 
        this.taskids = 8.1
        this.bgtips = ''
      }
      // 第二次曝光
        if (this.taskids == 8.3) { 
        this.taskids = 8.31
        this.bgtips = ''
      }
     

    },
    // 开始曝光
    bgstart() {
      console.log('曝光完成', this.taskids)
      if (this.id == 1 && this.taskids == 8) {
        // 项目1 曝光一次 60kv
        this.bgtips =
          '分别对大小焦点下60、80、100、120各个档位进行操作（每个档位至少曝光三次）'
      }
      if (this.id == 2 && this.taskids == 8) {
        // 项目1 曝光一次 60kv
        this.bgtips = '在大焦点条件下，对80kV档位进行曝光5次'
      }
      // 项目3-1
      if (this.id == 3 && (this.taskids == 8.1 || this.taskids == 8)) {
        this.bgtips = '在80kV、200mA、100ms、20mAs档位进行曝光5次'
      }
      if (this.id == 3 && this.taskids == 8.2) {
        this.bgtips = '在80kV、100mA、200ms、20mAs档位进行曝光5次'
      }
      if (this.id == 4 && this.taskids == 8) {
        // 项目1 曝光一次 60kv
        this.bgtips = '在80kV、200mA、100ms、20mAs档位进行曝光3次'
      }
      // 项目5-1
      if (this.id == 5 && (this.taskids == 8.1 || this.taskids == 8)) {
        this.bgtips = '在80kV、200mA、100ms档位进行曝光3次'
      }
      if (this.id == 5 && this.taskids == 8.2) {
        this.bgtips = '在80kV、200mA、80ms档位进行曝光3次'
      }
    },
    // 报错曝光
    bgsave() {
      // 验证当前曝光次数 和 曝光项目 1
      if (this.id == 1 && this.taskids == 7.1) {
        // 项目1 曝光一次 60kv
        if (this.kv == 60) {
          this.taskid = 8
        } else {
          // 提示输入错误的曝光
          this.wtext = '输入错误'
          this.$refs.tybox1.classList.add('tymb')
          this.timer = setTimeout(() => {
            this.$refs.tybox1.classList.remove('tymb')
            this.wtext = ''
            clearTimeout(this.timer)
          }, 1000)
        }
      }
      // 曝光项目2
      if (this.id == 2 && this.taskids == 7.1) {
        // 项目1 曝光一次 60kv
        if (this.kv == 80) {
          this.taskid = 8
        } else {
          // 提示输入错误的曝光
          this.wtext = '输入错误'
          this.$refs.tybox1.classList.add('tymb')
          this.timer = setTimeout(() => {
            this.$refs.tybox1.classList.remove('tymb')
            this.wtext = ''
            clearTimeout(this.timer)
          }, 1000)
        }
      }
      // 曝光项目3-1
      if (this.id == 3 && this.taskids == 7.1) {
        // 项目1 曝光一次 60kv
        if (
          this.kv == 80 &&
          this.ma == 200 &&
          this.ms == 100 &&
          this.mas == 20
        ) {
          this.taskid = 8

          setTimeout(() => {
            this.taskids = 8.1
          }, 1)
        } else {
          // 提示输入错误的曝光
          this.wtext = '输入错误'
          if (this.kv !== 80) {
            this.$refs.tybox1.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.mas !== 20) {
            this.$refs.tybox2.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ms !== 100) {
            this.$refs.tybox3.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ma !== 200) {
            this.$refs.tybox4.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
        }
      }
      if (this.id == 3 && this.taskids == 7.2) {
        // 项目1 曝光一次 60kv
        if (
          this.kv == 80 &&
          this.ma == 100 &&
          this.ms == 200 &&
          this.mas == 20
        ) {
          this.taskid = 8
          setTimeout(() => {
            this.taskids = 8.2
          }, 1)
        } else {
          // 提示输入错误的曝光
          this.wtext = '输入错误'
          if (this.kv !== 80) {
            this.$refs.tybox1.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.mas !== 20) {
            this.$refs.tybox2.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ms !== 200) {
            this.$refs.tybox3.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ma !== 100) {
            this.$refs.tybox4.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
        }
      }
      // 曝光项目4
      if (this.id == 4 && this.taskids == 7.1) {
        // 项目1 曝光一次 60kv
        if (
          this.kv == 80 &&
          this.ma == 200 &&
          this.ms == 100 &&
          this.mas == 20
        ) {
          this.taskid = 8
        } else {
          // 提示输入错误的曝光
          this.wtext = '输入错误'
          if (this.kv !== 80) {
            this.$refs.tybox1.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.mas !== 20) {
            this.$refs.tybox2.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ms !== 100) {
            this.$refs.tybox3.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ma !== 200) {
            this.$refs.tybox4.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
        }
      }

      // 曝光项目5-1
      if (this.id == 5 && this.taskids == 7.1) {
        // 项目1 曝光一次 60kv
        if (this.kv == 80 && this.ma == 200 && this.ms == 100) {
          this.taskid = 8

          setTimeout(() => {
            this.taskids = 8.1
          }, 1)
        } else {
          // 提示输入错误的曝光
          this.wtext = '输入错误'
          if (this.kv !== 80) {
            this.$refs.tybox1.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ms !== 100) {
            this.$refs.tybox3.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ma !== 200) {
            this.$refs.tybox4.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
        }
      }
      if (this.id == 5 && this.taskids == 7.2) {
        // 项目1 曝光一次 60kv
        if (this.kv == 80 && this.ma == 200 && this.ms == 80) {
          this.taskid = 8
          setTimeout(() => {
            this.taskids = 8.2
          }, 1)
        } else {
          // 提示输入错误的曝光
          this.wtext = '输入错误'
          if (this.kv !== 80) {
            this.$refs.tybox1.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }

          if (this.ms !== 80) {
            this.$refs.tybox3.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
          if (this.ma !== 200) {
            this.$refs.tybox4.classList.add('tymb')
            this.timer = setTimeout(() => {
              this.$refs.tybox1.classList.remove('tymb')
              this.$refs.tybox2.classList.remove('tymb')
              this.$refs.tybox3.classList.remove('tymb')
              this.$refs.tybox4.classList.remove('tymb')
              this.wtext = ''
              clearTimeout(this.timer)
            }, 1000)
          }
        }
      }
    },
    // 大步骤清理函数
    clearfn() {
      this.choiceid = 0
      this.gjltips = ''
      this.wpid = []
      this.choicetip = 0
      this.timer = null
      this.sum = 0
      this.jianguanj21hover = false
      this.jianguanj2hover = false
      this.jlstips = ''
    },
    // 清理四个输入框的描边
    clearmbfn() {
      if (this.$refs.hzbh.classList) {
        this.$refs.hzbh.classList.add('hsmb')
        this.$refs.hzname.classList.add('hsmb')
        this.$refs.jcbh.classList.add('hsmb')
        this.$refs.jcdjh.classList.add('hsmb')
      }
    }
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    this.init()
  },
  beforeCreate() {},
  beforeMount() {},
  beforeUpdate() {},
  updated() {},
  beforeDestroy() {},
  destroyed() {},
  activated() {}
}
